package xujun.control;

import javax.swing.*;
import java.awt.*;


/**
 * @author 徐骏
 * @data 2010-7-7
 */
public class XSeparator extends JSeparator {
    private Image image;
    private TexturePaint paint;

    public XSeparator() {
        image = XContorlUtil.getImage("xujun/control/images/separator_background.png");
        paint = XContorlUtil.createTexturePaint("xujun/control/images/separator_background.png");
    }

    public XSeparator(int direction) {
        super(direction);
        image = XContorlUtil.getImage("xujun/control/images/separator_background.png");
        paint = XContorlUtil.createTexturePaint("xujun/control/images/separator_background.png");
    }

    public void paintComponent(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        g2d.setPaint(paint);
        int x = 0;
        int y = 0;
        int width = getWidth();
        int height = image.getHeight(null);
        g2d.fillRect(x, y, width, height);
    }
}
